package com.moss.cloud.common.core.model.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class TreeNode implements Serializable {
    public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    /**
     * 节点内码
     */
    private Long id;
    /**
     * 节点名称
     */
    private String name;
    /**
     * 父节点内码
     */
    private Long parentId;
    /** 描述 */
    private String description;
    /** 级别*/
    private Integer level;
    /** 排序*/
    private Integer orderNum;
    /** 路径或者组件名称*/
    private String pathName;
    /** 图标地址或者图标名称*/
    private String icon;
    /** 打开方式（1tab方式，2单独页面） */
    private Integer openMethod;
    private String createdBy;
    private String updatedBy;
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = DATE_FORMAT)
    private LocalDateTime createdTime;
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = DATE_FORMAT)
    private LocalDateTime updatedTime;
    /**
     * 是否禁用（0启用；1禁用；2删除）
     */
    private Integer deleted;
    /**
     * 子节点集合
     */
    private List<TreeNode> children;
}
